#!/usr/bin/env python
# -*- coding: utf-8 -*-

from django.db import connection

from web.dao.base_dao import BaseDao
from web.models.commodity_future_analysis_detail import CommodityFutureAnalysisDetail

class CommodityFutureAnalysisDetailDao(BaseDao):
    """
    CommodityFutureAnalysisDetail的dao类
    """

    model_class = CommodityFutureAnalysisDetail

    def write_by_code(self, variance_type: str, variance_value: int, ma_type: str, ma_backtrack: int, code: str):
        """
        根据方差类型、方差取值、MA类型、MA回溯时间和期货代码，海量更新数据
        """

        with connection.cursor() as cursor:
            cursor.callproc("PKG_C_F_ANALYSIS_DETAIL.WRITE_BY_CODE", [variance_type, variance_value, ma_type, ma_backtrack, code])